Skip to content

Conversation

@cushon
Copy link
Contributor

@cushon cushon commented Oct 28, 2025

JDK-8341779 is a redo of the backport of JDK-8323093, see also discussion in CSR JDK-8346471.

JDK-8341779 was backported to JDK 21u and released in 21.0.8, as discussed in the CSR this PR proposes integrating it into a future 17u release now that 21.0.8 has been released.

Similar to JDK-8360406 for 21u, a future backport will disable this logic for 17u by default, and optionally allow the fix to be enabled with -XDaddTypeAnnotationsToSymbol.

The patch did not apply cleanly, I resolved one merge conflict due to changes to the internal TypeMetadata API for JDK-8303820.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • JDK-8340024 needs maintainer approval
  • JDK-8341779 needs maintainer approval
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8346471 to be approved

Issues

  • JDK-8341779: [REDO BACKPORT] type annotations are not visible to javac plugins across compilation boundaries (JDK-8225377) (Bug - P3 - Approved)
  • JDK-8340024: In ClassReader, extract a constant for the superclass supertype_index (Enhancement - P4 - Approved)
  • JDK-8346471: [REDO BACKPORT] type annotations are not visible to javac plugins across compilation boundaries (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/4124/head:pull/4124
$ git checkout pull/4124

Update a local copy of the PR:
$ git checkout pull/4124
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/4124/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4124

View PR using the GUI difftool:
$ git pr show -t 4124

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/4124.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 28, 2025

👋 Welcome back cushon! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 28, 2025

@cushon This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8341779: [REDO BACKPORT] type annotations are not visible to javac plugins across compilation boundaries (JDK-8225377)
8340024: In ClassReader, extract a constant for the superclass supertype_index

Reviewed-by: vromero

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vicente-romero-oracle) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot changed the title Backport de6667cf11aa59d1bab78ae5fb235ea0b901d5c4 8225377: type annotations are not visible to javac plugins across compilation boundaries Oct 28, 2025
@openjdk
Copy link

openjdk bot commented Oct 28, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Oct 28, 2025
@openjdk
Copy link

openjdk bot commented Oct 28, 2025

At least one of the issues associated with this backport has a resolved CSR for a different version. As this means that this backport may also need a CSR, the csr label is being added to this pull request to signal this potential requirement. The command /csr unneeded can be used to remove the label in case a CSR is not needed.

@openjdk openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels Oct 28, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 28, 2025

Webrevs

@cushon cushon marked this pull request as draft October 28, 2025 16:23
@openjdk openjdk bot removed the rfr Pull request is ready for review label Oct 28, 2025
due to changes to the internal TypeMetadata API for JDK-8303820
@openjdk openjdk bot removed the clean Identical backport; no merge resolution required label Nov 1, 2025
@cushon cushon changed the title 8225377: type annotations are not visible to javac plugins across compilation boundaries 8225377: Type annotations are not visible to javac plugins across compilation boundaries Nov 1, 2025
@openjdk openjdk bot changed the title 8225377: Type annotations are not visible to javac plugins across compilation boundaries 8225377: type annotations are not visible to javac plugins across compilation boundaries Nov 1, 2025
@cushon cushon changed the title 8225377: type annotations are not visible to javac plugins across compilation boundaries 8341779: [REDO BACKPORT] type annotations are not visible to javac plugins across compilation boundaries (JDK-8225377) Nov 1, 2025
@cushon
Copy link
Contributor Author

cushon commented Nov 1, 2025

/issue add JDK-8341779

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Nov 1, 2025
@openjdk
Copy link

openjdk bot commented Nov 1, 2025

@cushon This issue is referenced in the PR title - it will now be updated.

@cushon
Copy link
Contributor Author

cushon commented Nov 1, 2025

/issue add JDK-8340024

@openjdk
Copy link

openjdk bot commented Nov 1, 2025

@cushon
Adding additional issue to issue list: 8340024: In ClassReader, extract a constant for the superclass supertype_index.

@cushon cushon marked this pull request as ready for review November 1, 2025 21:26
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 1, 2025
@cushon
Copy link
Contributor Author

cushon commented Nov 2, 2025

/approval JDK-8341779 request for backport. Fixes a bug in javac's implementation of TypeMirror to allow accessing type-use annotations on types loaded from class files.

Risk: The feature will be disabled by default behind an -XD flag, similar to 21u (see JDK-8360406). See also discussion in CSR JDK-8346471.

Testing: Tier 1 tests pass. The changes were backported to 21u and released in 21.0.8. The fix is also present in JDK 22 and newer releases.

Dependencies: If approved, the following related fixes should also be backported: JDK-8337795, JDK-8340024, JDK-8337998, JDK-8354893, JDK-8360406

@openjdk
Copy link

openjdk bot commented Nov 2, 2025

@cushon
JDK-8341779: The approval request has been created successfully.

@cushon
Copy link
Contributor Author

cushon commented Nov 2, 2025

/approval JDK-8340024 request for backport. No-risk clean-up change for code hygiene, which also also included in JDK 21 as part of the JDK-8341779 redo, see https://git.openjdk.org/jdk21u-dev/pull/1671.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Nov 2, 2025
@openjdk
Copy link

openjdk bot commented Nov 2, 2025

@cushon
JDK-8340024: The approval request has been created successfully.

@GoeLin
Copy link
Member

GoeLin commented Nov 19, 2025

Hi @cushon,
do we really need this in 17?
How far is the feature used in 21 by the community given the flag is needed? Is there any adoption?
Why can't users just go to 25 or 21?
It is not very desireable to have kind of hidden features in an update release.

@cushon
Copy link
Contributor Author

cushon commented Nov 24, 2025

Hi @cushon, do we really need this in 17? How far is the feature used in 21 by the community given the flag is needed? Is there any adoption? Why can't users just go to 25 or 21? It is not very desireable to have kind of hidden features in an update release.

Hi @GoeLin, here's the background I have:

Spring Boot 4 has adopted type use annotations for nullness (see this blog post). The post mentions using -XDaddTypeAnnotationsToSymbol with JDK 21. They also support JDK 17 as a baseline. So there are going to be some users of Spring Boot 4 who upgrade, but stay on JDK 17, and would benefit from the fix.

Another use-case is NullAway, which recommends the -XD flag if it is available, and supports JDK 17.

I appreciate the desire to not have hidden features. At the same time I think having this fix available even behind an -XD flag has some value to the ecosystem. There has been some additional recent usage of type annotations due to the JSpecify annotations, and if Null-Restricted and Nullable Types happens in a future release then we may be in a window where type annotations are most useful. I would like to try to make this fix available to parts of the ecosystem that aren't able to upgrade from 17 to 21 yet.

What do you think?

@GoeLin
Copy link
Member

GoeLin commented Dec 3, 2025

Hi @cushon
Thanks for the detailed explanation. I will approve it.
Please backport the follow-ups asap, especially the flag switching it off.

@openjdk openjdk bot removed the approval Requires approval; will be removed when approval is received label Dec 3, 2025
@cushon
Copy link
Contributor Author

cushon commented Dec 3, 2025

Thanks! I will aim to backport the the follow-ups close together with this change.

Copy link

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants